<%@Page Language="VB"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Simple Single-Value Data Binding</title>
<style type="text/css">
body, td {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
input {font-family:Tahoma,Arial,sans-serif; font-size:9pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.subhead {font-family:Tahoma,Arial,sans-serif; font-size:12pt; font-weight:bold; padding-bottom:5px}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</style></head>
<body bgcolor="#ffffff">
<span class="heading">Simple Single-Value Data Binding</span><hr />
<!--------------------------------------------------------------------------->
<form runat="server">
<table border="0">
<tr><td nowrap="nowrap">


<b>&lt;ASP:Label&gt;</b> control:
<ASP:Label Text="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:TextBox&gt;</b> control:
<ASP:TextBox Text="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:Button&gt;</b> control:
<ASP:Button Text="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:LinkButton&gt;</b> control:
<ASP:LinkButton Text="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:Image&gt;</b> control:
<ASP:Image Src="<%# ImageURL %>" ImageAlign="middle" runat="server" /><p />

<b>&lt;ASP:CheckBox&gt;</b> control:
<ASP:CheckBox Text="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:RadioButton&gt;</b> control:
<ASP:RadioButton Text="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:Hyperlink&gt;</b> control:
<ASP:Hyperlink Text="<%# ImageURL %>" NavigateUrl="<%# ImageURL %>" runat="server" /><p />

<b>&lt;ASP:ImageButton&gt;</b> control:
<ASP:ImageButton ImageUrl="<%# ImageURL %>" runat="server" />


</td><td nowrap="nowrap">&nbsp; &nbsp; &nbsp;</td><td nowrap="nowrap">


HTML <b>&lt;span&gt;</b> element:
<span><%# ImageURL %></span><p />

HTML <b>&lt;input type="text"&gt;</b> element:
<input type="text" value="<%# ImageURL %>" /><p />

HTML <b>&lt;input type="submit"&gt;</b> element:
<input type="submit" value="<%# ImageURL %>" /><p />

HTML <b>&lt;button&gt;</b> element:
<button><%# ImageURL %></button><p />

HTML <b>&lt;img&gt;</b> element:
<img src="<%# ImageURL %>" align="middle" /><p />

HTML <b>&lt;input type="checkbox"&gt;</b> element:
<input type="checkbox" /><%# ImageURL %><p />

HTML <b>&lt;input type="radio"&gt;</b> element:
<input type="radio" /><%# ImageURL %><p />

HTML <b>&lt;a&gt;</b> element:
<a href="<%# ImageURL %>"><%# ImageURL %></a><p />

HTML <b>&lt;button&gt;</b> and <b>&lt;img&gt;</b> elements:
<button><img src="<%# ImageURL %>"></button>


</td></tr>
</table>
</form>
<!--------------------------------------------------------------------------->

<script language="vb" runat="server">

ReadOnly Property ImageURL() As String
   'declare a read-only property for the Page
   Get
       Return "myimage.gif"
   End Get
End Property

Sub Page_Load()
   'bind all the controls on the page
   Page.DataBind()
End Sub

</script>

<!--------------------------------------------------------------------------->
<hr /><span class="cite">[<a href="../global/viewsource.aspx">view source</a>] &nbsp; &nbsp; &nbsp; &nbsp;
&copy;2001 <a class="cite" href="http://www.wrox.com/">Wrox Press</a> -
<a class="cite" href="http://www.wrox.com/Books/Book_Details.asp?isbn=1861004885">Professional ASP.NET</a> (ISBN: 1-861004-88-5)</span>
</body>
</html>
